package 面试.新国都;

import java.util.Scanner;

/**
 * @author : K k
 * @date : 20:05 2020/10/14
 */
public class 打印XGD {
    static int[][] X = {{0,0},{0,4},{1,1},{1,3},{2,2},{3,1},{3,3},{4,0},{4,4}};
    static int[][] G = {{0,1},{0,2},{0,3},{0,4},{1,0},{2,0},{2,3},{2,4},{3,0},{3,4},{4,1},{4,2},{4,3},{4,4}};
    static int[][] D = {{0,0},{0,1},{0,2},{1,0},{1,3},{2,0},{2,4},{3,0},{3,3},{4,0},{4,1},{4,2}};
    //思路递归
    /**
     *
     * @param n 递归层次
     * @param c 待打印的字符
     * @return
     */
    public static String[][] resolver(int n,char c){
        String[][] res;
        if(n==1){
            //递归出口
            res=new String[1][1];
            res[0][0]=c+"";
            return res;
        }
        int size=(int)Math.pow(5,n-1);
        res=new String[size][size]; //定义当前层次的数组
        String[][] tmp= resolver(n-1,c);//下一层
        int[][] p;
        if(c=='X')p=X;
        else if(c=='G')p=G;
        else p = D;
        for(int[] pot : p)   //进行copy
            print(res,tmp,pot[0],pot[1]);
        return res;

    }

    private static void print(String[][] res, String[][] tmp, int x, int y) {
        x*=tmp.length;
        y*=tmp.length;
        for(int i=0;i<tmp.length;i++){
            for (int j = 0; j < tmp[0].length; j++) {
                res[i+x][j+y] = tmp[i][j];
            }
        }
    }

    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int n = in.nextInt();
        String[][] res_x =resolver(n,'X');
        String[][] res_g =resolver(n,'G');
        String[][] res_d =resolver(n,'D');
        for (int i = 0;i<res_x.length;i++) {
            for (String a:res_x[i]) {
                if(a!=null) System.out.printf(a);
                else System.out.printf(" ");
            }
            for (String a:res_g[i]) {
                if(a!=null) System.out.printf(a);
                else System.out.printf(" ");
            }
            int empty=0;//辅助输出空格
            for (String a:res_d[i]) {
                if(a!=null){
                    for(;empty>0;empty--)System.out.printf(" ");
                    System.out.printf(a);
                }
                else empty++;
            }
            System.out.println("");
        }

    }
}
